#include <iostream>
#include <string.h>
#include "dbus-service.h"
#include "utils.h"

Session* ss;
using namespace std;

int base64main() {
	const std::string s = "ADP GmbH\nAnalyse Design & Programmierung\nGesellschaft mit beschränkter Haftung" ;

	std::string encoded = base64_encode(reinterpret_cast<const unsigned char*>(s.c_str()), s.length());
	std::string decoded = base64_decode(encoded);

	std::cout << "encoded: " << encoded << std::endl;
	std::cout << "decoded: " << decoded << std::endl;

	return 0;
}


int main()
{

	PurpleConversation *conv;
	ss = new Session( conv );

	while( int in=getchar() ) 
	{
		bool stop = false;

		std::cout << ">>>" << std::endl;

		switch( in )
		{

			case 'b': {
				break;
			}

			case 'l': {
				break;
			}

			case 'L': {
				break;
			}

			case 'd': {

				break;
			}

			case 'a': {

				break;
			}

			case 'r': {

				break;
			}


			case 'O': {


					  break;
			}

			case 'o': {

				break;
			}

			case 'g': {
				break;
			}

			case 'e': {

				base64main();

				break;
			}


			case '0': {
				string msg ="<wb xmlns='http://inkscape.org/inkboard' session='ovknsoyuyr'><protocol><invite/></protocol></wb>";
				xmlnode *packet_xml = xmlnode4string( msg );
				Packet pkt = packet4xmlnode( packet_xml );

				if ( pkt.sid != "" ){
					cout << pkt.sid << endl;
					cout << pkt.from << endl;
					cout << pkt.type << endl;
					cout << pkt.data << endl;
				}

				break;
			}

			case 'q':{
				std::cout << "do quit" << std::endl;
				stop = true;
				break;
			}
			case EOF:
			default: {
				break;
			}
		}

		if ( stop ) { 
			break;
		}
	}
}

